const assert = require("assert");
const Sms = require("../src/sms.js");

describe("sms.js", () => {
	before(() => {
		Sms.init(
			"STS.NV1Ehd1Tvui7ngSQzzWJ1M5bK",
			"EqdKm6NNGBnH7tqtim9koH2TCCQB73NQQFLeKdZhhV7Y",
			"CAIShgJ1q6Ft5B2yfSjIr5WEDtLQ3ItXwqvcbEHitXovW8UdovDJqTz2IHFPeHJvBeAYt/8/mG5V6/wYlqZdVplOWU3Da+B364xK7Q75oxgrNgPyv9I+k5SANTW5KXyShb3/AYjQSNfaZY3eCTTtnTNyxr3XbCirW0ffX7SClZ9gaKZ8PGD6F00kYu1bPQx/ssQXGGLMPPK2SH7Qj3HXEVBjt3gX6wo9y9zmn5bFukKP1gygl7RE+N+oGPX+MZkwZqUYesyuwel7epDG1CNt8BVQ/M909vcVomuc4Y3NXQAKs0nYbreOqMcfBQt4d7U8NYVgq/fRhfBzp/DSkILNzBJALV/Y0qNT2WHLGoABmdjuUBTKnrxRWCsX7Mkdgq8zM1wiuk3uy49JMvYt6p35YWZuN4Tfpn9i8YU1sdj91EXaEqYcZ1LHx2RKcLIya138SAZCK9Huftl9aTB7kr8pz2eB9DpToOYV0C2LzoCifi3YHeeC4Ruqq6lqToVRl4ehGfxUB9CnRLj1cczJ5HQ="
		);
		Sms.debug(false);
	});

	describe("send()", () => {
		it("one param", (done) => {
			Sms.send(
				"13570922480",
				{ info: "1234567890" },
				"电影票快捷选座",
				"SMS_215335730"
			)
				.then(() => done())
				.catch((e) => done(e));
		});
		it("multi params", (done) => {
			Sms.send(
				"13570922480",
				{
					cinemaName: "广州大道南",
					filmName: "风萧萧兮易水寒",
					startTime: "2021-03-23 17:20:00",
					code: "207535,验证码:00159248",
				},
				"电影票快捷选座",
				"SMS_218895836"
			)
				.then(() => done())
				.catch((e) => done(e));
		});
	});
});
